#ifndef __COMMON_H__
#define __COMMON_H__

#include "comdef.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>

#ifdef WIN32
#include <time.h>
#include <conio.h>
#include <io.h>
#include <direct.h>
#include <stdlib.h>
typedef int socklen_t;
#endif

void my_sleep(unsigned long nSecord);
unsigned long GetTimeStamp(void);
void GetTime(char *pBuf);
void GetTimeEx(char *pBuf);
unsigned long my_GetLastError();
int CheckBuf(char *pData, unsigned int nDataLen, int &nCmd, int &nSendId, int &nPacketNum, int &nPacketLen);
int Utf8ToGBK(const char* strUtf8, int nLen, char *outBuf, int &nBuffLen);
int GBKToUtf8(const char* strGBK, int nLen, char *outBuf, int &nBuffLen);
bool CreateDir(const char *pszDirName);
bool DirExist(const char *pszDirName);

#endif
